home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_u_z / wedl121.zip / DEMO4.C < prev    next >
C/C++ Source or Header  |  1991-12-09  |  4KB  |  81 lines

  1.  
  2. /*---------------------------------------------------------------------------*/
  3. /*                                                                           */
  4. /*          WEDL - Windows Enhanced Dialog Library                           */
  5. /*          Copyright (c) 1991, Mike Smedley                                 */
  6. /*          All Rights Reserved                                              */
  7. /*          Module:  DEMO4.C                                                 */
  8. /*                                                                           */
  9. /*---------------------------------------------------------------------------*/
  10.  
  11. #include <windows.h>
  12. #include <stdio.h>
  13. #include "wedl.h"
  14. #include "demo.h"
  15.  
  16. /*---------------------------------------------------------------------------*/
  17.  
  18. int FAR PASCAL DialogProc4( HWND hDlg, unsigned message, WORD wParam,
  19.                             LONG lParam )
  20. {
  21.     static HFORM hform = NULL;
  22.     static char name[26]="", address[31]="", csz[36]="";
  23.     static unsigned long ssn=0L;
  24.     static double fitw=0.0, wages=0.0, sstax=0.0;
  25.  
  26.     switch( message ) {
  27.         case WM_INITDIALOG:
  28.             hform = form_begin( hDlg );
  29.             field_define( hform, ID_NAME, name, DT_STRING, "?(25)",
  30.                           FDF_NOTBLANK | FDF_UPDATE | FDF_MIXED, NULL, 0, 0 );
  31.             field_define( hform, ID_ADDRESS, address, DT_STRING, "?(30)",
  32.                           FDF_NOTBLANK | FDF_UPDATE | FDF_MIXED, NULL, 0, 0 );
  33.             field_define( hform, ID_CSZ, csz, DT_STRING, "?(35)",
  34.                           FDF_NOTBLANK | FDF_UPDATE | FDF_MIXED, NULL, 0, 0 );
  35.             field_define( hform, ID_SSN, &ssn, DT_ULONG, "999'-'99'-'9999",
  36.                           FDF_NOTBLANK | FDF_ZEROFILL | FDF_BLNKZERO |
  37.                           FDF_UPDATE | FDF_NUMERIC, NULL, 0, 0 );
  38.             field_define( hform, ID_FITW, &fitw, DT_DOUBLE, "'$ '9,999,999.99",
  39.                           FDF_CALCNUM | FDF_UPDATE | FDF_MUSTEDIT, NULL, 0, 0 );
  40.             field_define( hform, ID_WAGES, &wages, DT_DOUBLE, "'$ '9,999,999.99",
  41.                           FDF_CALCNUM | FDF_UPDATE | FDF_MUSTEDIT, NULL, 0, 0 );
  42.             field_define( hform, ID_SSTAX, &sstax, DT_DOUBLE, "'$ '9,999,999.99",
  43.                           FDF_CALCNUM | FDF_UPDATE | FDF_MUSTEDIT, NULL, 0, 0 );
  44.             statmsg_define( hform, ID_INSERT, SM_INSERT, "(Ins)", "(Ovr)" );
  45.             form_end( hform );
  46.             return( TRUE );
  47.  
  48.         case WM_COMMAND:
  49.             dproc_enter_wm_command( hform, wParam, lParam );
  50.             switch( wParam ) {
  51.  
  52.                 case IDOK:
  53.                     dproc_enter_idok( hform );
  54.                     if( !form_in_error_cond( hform ) ) {
  55.                         if( form_validate( hform ) != NULL ) break;
  56.                         form_process( hform );
  57.                         EndDialog( hDlg, TRUE );
  58.                         form_terminate( hform );
  59.                         sprintf( tbuf,
  60.                                  "Name:\t= %s\nAddress\t= %s\n"
  61.                                  "City, St\t= %s\n"
  62.                                  "SSN:\t= %09lu\nFITW:\t= %.2lf\n"
  63.                                  "Wages:\t= %.2lf\nSS Tax:\t= %.2lf\n",
  64.                                  name, address, csz, ssn, fitw, wages, sstax );
  65.                         MessageBox( NULL, tbuf, "Field Contents", MB_OK );
  66.                     }
  67.                     return( TRUE );
  68.  
  69.                 case IDCANCEL:
  70.                     dproc_enter_idcancel( hform );
  71.                     EndDialog( hDlg, TRUE );
  72.                     form_terminate( hform );
  73.                     return( TRUE );
  74.  
  75.             }
  76.             break;
  77.     }
  78.     return( FALSE );
  79. }
  80.  
  81.